#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import os
import sys

#output file node num in our file & diff between our file and gt


def main():

    sourcefile=sys.argv[1]#tse file
    targetfile=sys.argv[2]#our file

    
    if not os.path.exists(sourcefile):
        print('tse file is invalid')
        exit(1)
    if not os.path.exists(targetfile):
        print('your file is invalid')
        exit(1)

    lineset = set()

    # print('ok')
    with open(sourcefile,mode='r') as source:
        for line in source:
            #print(line)
            line=line.strip()
            f1=line.split()[0]
            f2=line.split()[1]
            lineset.add(f1)
            lineset.add(f2)
        source.close()

    tsenum=len(lineset)
    morefile = set()

    with open(targetfile,mode='r') as target:
        for line in target:
            #print(line)
            line=line.strip()
            f1=line.split()[0]
            f2=line.split()[1]
            if f1 in lineset:
                lineset.remove(f1)
            if f2 in lineset:
                lineset.remove(f2)
            morefile.add(f1)
            morefile.add(f2)
        target.close()
    num=len(morefile)

    with open(sourcefile,mode='r') as source:
        for line in source:
            #print(line)
            line=line.strip()
            f1=line.split()[0]
            f2=line.split()[1]
            if f1 in morefile:
                morefile.remove(f1)
            if f2 in morefile:
                morefile.remove(f2)
        source.close()



    for k in lineset:
        print(k)
    print("miss total:"+str(len(lineset)))

    for k in morefile:
        print(k)


    print("miss total:"+str(len(lineset)))
    print("more total:"+str(len(morefile)))
    print("tse has file:"+str(tsenum))
    print("mdg has file:"+str(num))


    
if __name__=='__main__':
    main()
    
